package com.doit.day03.不可变集合

import java.sql.{Connection, DriverManager, PreparedStatement}

object _05_foreach {
  def main(args: Array[String]): Unit = {
    val arr: Array[Int] = Array(1, 2, 3, 4, 5)

    val conn: Connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "123456")
    val pps: PreparedStatement = conn.prepareStatement("insert into guid values(?)")

    //常用于打印，没有返回值
    arr.foreach(
      a=>{
        pps.setInt(1,a)
        pps.execute()
      }
    )

  }
}
